<template>
    <div style="position: fixed;z-index: 100;">
    <TitleLenged
      :isShow="isShowTitle"
      :titleText="titleText"
    ></TitleLenged>
 
    <CostomProgress
      :title="c_title"
      :modal2Visible="c_visable"
      :percent="c_percent"
    ></CostomProgress>
  </div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex';
import * as mapOper from '../../scripts/mapOper.js';
import TitleLenged from '../mainContent/TitleLenged.vue';
import CostomProgress from '../progress/index.vue';
let config = require('../../config/config');
import commonOper from '../../scripts/commonOper';
//var _ = require('lodash');
export default {
  name:'R1010303',
  computed: {
    ...mapGetters(['map', 'contentHeight'])
  },
  data() {
    return {
     
      // 是否显示标题
      isShowTitle: false,
      // 标题内容
      titleText: '',
      //自定义进度条数据
      c_title: '',
      c_percent: 0,
      c_visable: false,
      //矿区本地数据
      mineLocalData: null,
      
    };
  },
  components: {
    TitleLenged,
    CostomProgress,
  },
  mounted: function() {
   
    /**
     * 清除地图
     */
    if (this.map) {
      let map = mapOper.removeAllLayers(this.map);
      this.changeMap({ map: map });

      let imap = mapOper.removeInteractions(this.map);
      this.changeMap({ map: imap });
      let omap = mapOper.removeAllOverlay(this.map);
      this.changeMap({ map: omap });
      this.c_title = '加载中';
      this.c_visable = true;

      //加载矿区wfs图层
      let params = {
        this: this,
        url:
          config.baseMapUrl +
          'wuhai-wfsmap?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=chimney&OUTPUTFORMAT=json',
        successFunc: response => {
          let that = this;
          that.mineLocalData = response.data;
          let style=mapOper.getGeoJsonStyle('Chimney');
          let wfsParams = {
            map: that.map,
            jsonData: that.mineLocalData,
            style:style,
            styleFunc:null,
          };
          let wfsmap = mapOper.loadWFSLayer(wfsParams);
          this.changeMap({ map: wfsmap });
          that.c_title = '加载中';
          that.c_visable = false;
          this.isShowTitle = true;

          this.titleText = '乌海烟囱分布情况';
    
        }
      };
      commonOper.HttpGet(params);
    } else {
      this.$router.push({
        //核心语句
        path: 'R101.html' //跳转的路径
      });
    }
  },
  methods:{
    ...mapActions(['changeMap', 'changeLengedTitle']),
  }
};
</script>

